//
//  Zone.m
//  07_HomeWork
//
//  Created by dllo on 16/7/12.
//  Copyright © 2016年 LST. All rights reserved.
//

#import "Zone.h"

@implementation Zone
- (void)dealloc {
    [_name release];
    [_number release];
    [super dealloc];
}
- (void)setName:(NSString *)name {
    if (_name != name) {
        [_name release];
        _name = [name retain];
    }
}
- (void)setNumber:(NSString *)number {
    if (_number != number) {
        [_number release];
        _number = [number retain];
    }
}
- (instancetype)initWithName:(NSString *)name number:(NSString *)number {
    self = [super init];
    if (self) {
        _name = [name copy];
        _number = [number copy];
    }
    return self;
}
+ (instancetype)zoneWithName:(NSString *)name number:(NSString *)number {
    return [[[self alloc] initWithName:name number:number]autorelease];
}
- (NSString *)description {
    return [NSString stringWithFormat:@"%@", _name];
}
- (instancetype)initWithCity:(CityTemp *)city {
    return [self initWithName:city.cityName number:city.cityNumber];
    
}
+ (instancetype)zoneWithCity:(CityTemp *)city {
    return [[[self alloc] initWithCity:city] autorelease];
}

@end
